<template>
	<view class="">
		<van-cell-group>
			<van-cell v-for="(item, index) in locations" :key="index" :title="item.name"
				@click="navigateToAddress(item)" />
		</van-cell-group>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue";
	import {
		postfloorList
	} from "@/api/index.js"
	import {
		onLoad
	} from "@dcloudio/uni-app";
	onLoad(() => {
		funclogin()
	})
	const loginInfo = ref()
	const locations = ref([]);
	const funclogin = () => {
		loginInfo.value = uni.getStorageSync("school_id")
		
		postfloorList({
			depid: loginInfo.value
		}).then(res => {
			console.log("我数据呢",res);
			locations.value = res.data
		})
	}
	const navigateToAddress = (item) => {
		uni.setStorageSync("floor_info",item)
		console.log("我看看值",item);
		uni.navigateBack()
		// uni.redirectTo({
		// 	url: `/package/pages/address_rep/address_rep?name=${item.name}&id=${item.id}`,
		// });
	};
</script>

<style scoped>
	
	::v-deep .van-cell__title {
		font-size: 32rpx;
		margin: 20rpx 0;
		padding-left: 20rpx;
	}
	
</style>